<template>
  <div class="home">
    <div class="content">
      <img alt="logo" src="@/assets/logo.jpg" />
    </div>
    <h2>欢迎{{ role }} {{ username }},来到臻品酒店管理系统</h2>
  </div>
</template>

<script>
import { meInfo, IsLogin } from '@/api/admin'
import { getMeInfo, getEmployeesIsLogin } from '@/api/employee'

export default {
  data () {
    return {
      role: '',
      username: '',
    };
  },
  created() {
    if (!localStorage.getItem('Premium Hotel System')) {
      this.$router.push('/manage/login')
    }
    if (this.$route.path.includes('employee')) {
      this.role = '员工'
      getMeInfo().then(res => {
        // console.error(res)
        this.username = res.nickname
      })
    } else if (this.$route.path.includes('admin')) {
      this.role = '管理员 '
      meInfo().then(res => {
        // console.error(res)
        console.error(res.username)
        this.username = res.username
      })
    }
    // if (this.username == '') {
    //   this.$router.push('/manage/login')
    //   this.$notify.info({
    //     title: '消息',
    //     message: '请登录'
    //   });
    // }
  }
};
</script>

<style scoped>
.content {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  /*使子项目水平居中*/
  align-items: center;
  /*使子项目垂直居中*/
}

img {
  width: 40%;
  height: auto;
  /* position: relative;
  left: 30%; */
  /* user-select: none; */
}

h2 {
  text-align: center;
}
</style>
